home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / util / gnu / xpdf-0.8-src.lha / xpdf-0.8-src / ltk / LTKScrollbar.h < prev    next >
C/C++ Source or Header  |  1998-11-28  |  2KB  |  86 lines

  1. //========================================================================
  2. //
  3. // LTKScrollbar.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8.  
  9. #ifndef LTKSCROLLBAR_H
  10. #define LTKSCROLLBAR_H
  11.  
  12. #ifdef __GNUC__
  13. #pragma interface
  14. #endif
  15.  
  16. #include <stddef.h>
  17. #include <X11/Xlib.h>
  18. #include "gtypes.h"
  19. #include "LTKWidget.h"
  20.  
  21. //------------------------------------------------------------------------
  22. // LTKScrollbar
  23. //------------------------------------------------------------------------
  24.  
  25. class LTKScrollbar: public LTKWidget {
  26. public:
  27.  
  28.   //---------- constructor ----------
  29.  
  30.   LTKScrollbar(char *name1, int widgetNum1,
  31.            GBool vertical1, int minPos1, int maxPos1,
  32.            LTKIntValCbk moveCbk1);
  33.  
  34.   //---------- access ----------
  35.  
  36.   virtual long getEventMask();
  37.  
  38.   //---------- special access ----------
  39.  
  40.   void setLimits(int minPos1, int maxPos1);
  41.   void setPos(int pos1, int size1);
  42.   int getPos() { return pos; }
  43.   void setScrollDelta(int scrollDelta1) { scrollDelta = scrollDelta1; }
  44.   void setRepeatPeriod(int period) { repeatPeriod = period; }
  45.  
  46.   //---------- layout ----------
  47.  
  48.   virtual void layout1();
  49.  
  50.   //---------- drawing ----------
  51.  
  52.   virtual void redraw();
  53.  
  54.   //---------- callbacks and event handlers ----------
  55.  
  56.   virtual void buttonPress(int mx, int my, int button, GBool dblClick);
  57.   virtual void buttonRelease(int mx, int my, int button, GBool click);
  58.   virtual void mouseMove(int mx, int my, int btn);
  59.   virtual void repeatEvent();
  60.  
  61. protected:
  62.  
  63.   void drawUpButton();
  64.   void drawDownButton();
  65.   void drawSlider(int pos1, Bool on);
  66.   void doScroll();
  67.  
  68.   GBool vertical;        // orientation: 1=vertical, 0=horizontal
  69.   int minPos, maxPos;        // min and max positions
  70.                 //   (minPos <= pos <= maxPos - size + 1)
  71.  
  72.   int pos, size;        // slider position and size
  73.   int scrollDelta;        // scroll amount
  74.   int repeatPeriod;        // time (us) between repeats
  75.   int pixelPos, pixelSize;    // slider pos and size in pixels
  76.   int pushPos;            // slider pos when pressed
  77.   int pushPixel;        // mouse coord when pressed
  78.   GBool sliderPressed;        // mouse has been pressed on slider
  79.   GBool upPressed;        // up/left button is pressed
  80.   GBool downPressed;        // down/right button is pressed
  81.  
  82.   LTKIntValCbk moveCbk;        // slider-move callback
  83. };
  84.  
  85. #endif
  86.